package tests;

import java.io.File;

import core.MainLexico;
import core.util.Util;

import junit.framework.TestCase;

public class AnalisadorLexicoTest extends TestCase {
	private static final String FILE_SEPARATOR = System
			.getProperty("file.separator");

	private static final String TESTS_DIR = System.getProperty("user.dir")
			+ FILE_SEPARATOR + "input" + FILE_SEPARATOR + "sintatico";

	public void testAll() throws Exception {
		System.out.println("===============================================");
		System.out.println("## TESTE LEXICO ESPERANDO QUE NAO OCORRAM ERROS ##");

		int contadorDeTestes = 0;
		for (String fileName : Util.getOclFilesInOrder(TESTS_DIR)) {
			try {
				MainLexico.executeLexicAnalyzer(TESTS_DIR + FILE_SEPARATOR
					+ fileName);
			} catch (Exception e) {
				e.printStackTrace();

				fail(e.getMessage());
			}
			contadorDeTestes++;
		}

		System.out.println("===============================================");
		System.out.println("Total de arquivos analisados = " + contadorDeTestes);
	}
}
